<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script> -->
    <script src="../js/vue.js"></script>
    <style>
        /* 三个大背景 */
        #bg1{
            position: absolute;
            height: 100%;
            width: 100%;
            left: 0;
            top: 0;
            /*background-color: #D8D8BF;*/
            background: url(../picture/1.webp);
            background-size: 1400px 1000px;
        }
        #bg2{
            position: absolute;
            bottom: 0%;
            right: 0%;
            height: 92%;
            width: 96%;
            left: 1%;
        }
        #bg3{
            position: absolute;
            bottom: 0%;
            right: 0%;
            height: 93%;
            width: 81%;
            top: 1%;
        }
        /* logo */
        .logo_title{
            position: relative;
            color: yellow;
            font-size: 35px;
            font-weight: 700;
            top: 0.5%;
            left: 1%;
            font-family: STHupo;
        }
        
        .workspace{
            position: relative;
            color: #000000;
            font-size: 25px;
            font-weight: 600;
            top: 0%;
            font-family: SimHei;
            /*left: 2%;*/
        }
        /* 添加项目 按钮 */
        #add_project{
            position: relative;
            color: #000000;
            background-color: #5ACD;
            border: none;
            font-size: 30px;
            font-weight: 500;
            height: 5.5%;
            width: 2.5%;
            top: 1%;
            left: 1%;
            border-radius: 10%;
        }
        /* api方法选择框 */
        #get_or_post{
            position: relative;
            top: 3%;
            left: 2%;
            height: 8%;
            width: 8%;
            font-size: 21px;
            font-weight: 500;
            text-align: center;
            background-color: #5ACD;
            opacity: 0.8;
            appearance: none;
            outline: none;
            border: none;
        }
        .get_or_post_op{
            background-color: #5ACD;
            color: orange;
        }
        /* url输入框 */
        #url_input{
            position: relative;
            left: 5%;
            top: 3%;
            height: 8%;
            width: 60%;
            /*border-radius: 30px;*/
            background-color: #5ACD;
            opacity: 0.8;
            border: none;
            padding-left: 2%;
            font-size: 23px;
            font-weight: 300;
            color: rgb(97, 97, 97);
            outline: none;
        }
        /* send按钮 */
        .send_btn{
            position: relative;
            left: 8%;
            top: 3%;
            height: 8%;
            width: 15%;
            font-size: 23px;
            font-weight: 500;
            background-color: #5ACD;
            /*opacity: 0.8;*/
            border: none;
        }
        /* 数据div */
        .data{
            position: relative;
            width: 100%;
            height: 65%;
            top: 5%;
        }
        /* 模块title */
        .data_li{
            list-style-type: none;
            display: inline;
            font-size: 25px;
            margin: 8%;
            font-family: SimHei;
        }
        /* 模块下划线 */
        .li_param{
            position: absolute;
            width: 15%;
            height: 0.2%;
            background-color: white;
            left: 7%;
            top: 5%;
        }
        .li_headers{
            position: absolute;
            width: 15%;
            height: 0.2%;
            background-color: white;
            left: 30%;
            top: 5%;
        }
        .li_body{
            position: absolute;
            width: 15%;
            height: 0.2%;
            background-color: white;
            left: 52.3%;
            top: 5%;
        }
        .li_tests{
            position: absolute;
            width: 15%;
            height: 0.2%;
            background-color: white;
            left: 73%;
            top: 5%;
        }

        /* 模块div */
        .data_div{
            position: absolute;
            height: 75%;
            width: 100%;
            top: 9%;
        }
        .title_th_div{
            position: relative;
            height: 10%;
            width: 85%;
            left: 4%;
            background-color: #5ACD;
            opacity: 0.6;
        }
        .li_title{
            position: relative;
            left: 0%;
            list-style-type: none;
            display: inline;
            font-size: 20px;
            font-weight: 600;
            margin: 19%;
            font-size: 20px;
            color: orange;
        }
        .data_td_div{
            position: relative;
            height: 80%;
            width: 85%;
            left: 4%;
            background-color: #5ACD;
            opacity: 0.6;
            overflow-y: scroll;
        }
        .data_table{
            position: relative;
            width: 90%;
            left: 6%;
        }
        .data_input{
            width: 90%;
            height: 30px;
            border-radius: 30px;
            background-color: orange;
            opacity: 0.7;
            border: none;
            padding-left: 2%;
            font-size: 20px;
            font-weight: 300;
            /*color: #5ACD;*/
            text-align: center;
            margin: 2%;
            outline: none;
        }
        /* 增加行 按钮 */
        .add_li{
            position: absolute;
            color: #FFFEF4;
            background-color: #5ACD;
            border: none;
            font-size: 30px;
            font-weight: 500;
            height: 11%;
            width: 3%;
            top: 85%;
            left: 95%;
            /*border-radius: 10%;*/
        }
        /* 响应输入框 */
        #tests_text{
            background: #5ACD;
            opacity: 0.6;
            position: relative;
            height: 85%;
            width: 83%;
            top: 6%;
            left: 4%;
            border: none;
            outline: none;
            color: orange;
            font-size: 20px;
            font-weight: 600;
            resize:none;
            padding: 1%;
        }
        /* tests执行按钮 */
        .btn_go{
            position: absolute;
            color: #FFFEF4;
            background-color: #5ACD;
            border: none;
            font-size: 20px;
            font-weight: 600;
            height: 11%;
            width: 4%;
            top: 6%;
            left: 96%;
            /*border-radius: 10%;*/
        }
        /* 响应区 */
        .resp_div{
            position: absolute;
            width: 100%;
            height: 40%;
            top: 73%;
        }
        /* response */
        .resp_word{
            position: relative;
            left: 2%;
            font-family: SimHei;
            font-size: 25px;
        }
        /* hr */
        .part{
            position: absolute;
            top: 10%;
            left: 2%;
            width: 95%;
            height: 0.2%;
            background-color: #000000;
        }
        /* 响应返回div */
        .resp_data{
            position: relative;
            overflow-y: scroll;
            width: 98%;
            height: 80%;
            left: 2%;
            top: 8%;
            color: rgb(97, 97, 97);
            word-break :break-all;
        }

        .creat_project_page{
            position: absolute;
            background-color:orange;
            height: 50%;
            width: 45%;
            top: 46%;
            left:50%;
            -webkit-transform: translate(-50%, -50%);
            -moz-transform: translate(-50%, -50%);
            -ms-transform: translate(-50%, -50%);
            -o-transform: translate(-50%, -50%);
            transform: translate(-50%, -50%);
            border: 2px solid #D8D8BF
        }
        .creat_project_page_btn{
            position: relative;
            top: 13%;
            height: 25%;
            width: 100%;
        }
        #creat_project_page_create{
            position: relative;
            left: 22%;
            top: 95%;
            width: 15%;
            height: 50%;
            /*border-radius: 20px;*/
            background-color: orange;
            color: #5ACD;
            font-size: 35px;
            font-weight: 500;
            border: 2px solid orange;
        }
        #creat_project_page_cancle{
            position: relative;
            left: 35%;
            top: 95%;
            width: 15%;
            height: 50%;
            background-color: orange;
            color: #5ACD;
            font-size: 35px;
            font-weight: 500;
            border: 2px solid orange;
        }
        .creat_project_page_title_div{
            position:relative;
            /*background-color: rgba(198, 211, 213, 0.8);*/
            background-color: #D8D8BF;
            height: 10%;
        }
        #creat_project_page_title{
            position: relative;
            font-size: 24px;
            top:5%;
            left:33%;
        }
        .project_name_div{
            position: relative;
            top:5%;
            left: 3%;
            height:15%;
        }
        .project_description_div{
            position: relative;
            top:10%;
            left: 3%;
            height:40%;
        }
        .project_name{
            font-size: 120%;
        }
        .project_description{
            font-size: 120%;
        }
        #project_name_input{
            position: relative;
            top: 5%;
            font-size: 25px;
            color: orange;
            height: 55%;
            width: 90%;
        }
        #project_description_input{
            position: relative;
            top: 5%;
            font-size: 20px;
            color: grey;
            height: 80%;
            width: 90%;
        }
        .show_page{
            position: relative;
            width: 19%;
            height: 90%;
        }
        .show_project_div{
            background-color: #5ACD;
            position: relative;
            /*border-radius: 20px;*/
            left:2%;
            width: 50%;
            text-align: center;
            margin-top: 20px;
        }
        #list_one{
            font-size: 25px;
            line-height: 150%;
        }
        .show_project_li{
            background-color:  rgba(181, 201, 204, 0.8);
            
        }
        .menu{
            position: absolute;
            left: 85%;
            width: 150%;
            height: 400%;
            line-height: 40px;
            
            text-align: left;
            border: 1px solid orange;
            background-color: #5ACD;
            padding-left: -50%;
            display: none;
        }
        .menu>ul{
            position: relative;
            left:-8%;
        }
        .menu>ul>li{	
            list-style-type:none;
        }
        .show_project_div:hover .menu{
            display: block;
        }
        .content_li{
            position: relative;
            width:50%;
            height: 40%;
            left: 1%;
        }
        .content_li>ul>li{
            list-style-type:none;
            margin-top: 3%;
            background-color:#5ACD;
            text-align: center;
            font-size: 15px;
        }
        .content_li_a{
            font-size:60%;
            text-decoration:none !important;
            color:orange !important;
        }
        .tab{
            position: absolute;
            background-color: rgba(160, 178, 181, 0.8);
            border-radius: 20px;
            text-align: center;
            top:1%;
            height: 5%;
            left: 19%;
            width:13%;
        }
        .chahao{
            width: 10%;
            position:absolute;
            top:20%;
            left:80%;
        }
        .tab_title{
            position: relative;
            top:15%;
            font-size: 20px;
        }
        .case_menu{
            position: relative;
            height: 70px;
            line-height: 200%;
            font-size: 18px;
            text-align: center;
            border: 1px solid orange;
            display: none;
        }
        .case_menu>ul{
            position: absolute;
            padding-left: 5px;
            margin-top: 4px;
        }
        .case_menu>ul>li{	
            list-style-type:none;
        }
        .one:hover .case_menu{
            display: block;
        }
        #quit{
            text-decoration:none;
            font-weight: bold;
            font-size: 20px;
            float: right;
            font-family: 隶体;
            top:1%;
            color: orange;
        }
    </style>
</head>
<body>
    <div id="bg1">
        <span class="logo_title">iTest</span>
        <a href="login.html" id="quit">sign out</a>
        <div id="bg2">

            <!-- 左侧标识、按钮 -->
            <span class="workspace">workspace</span>
            <button id="add_project" @click="creat_project_page_show()">+</button>

            


            <div id="bg3">
                <!-- api方法选择框 -->
                <select id="get_or_post" v-model="apimethods">
                    <option value="get" class="get_or_post_op">GET</option>
                    <option value="post" class="get_or_post_op">POST</option>
                    <option value="PUT" class="get_or_post_op">PUT</option>
                    <option value="OPTIONS" class="get_or_post_op">OPTIONS</option>
                    <option value="HEAD" class="get_or_post_op">HEAD</option>
                </select>
                <!-- url输入框 -->
                <input type="text" id="url_input" v-model="get_url" @change="url_change">
                <!-- send按钮 -->
                <button class="send_btn" @click="send_click">Send</button>
                <div class="data">
                    <!-- 选择模块 -->
                    <ul>
                        <li class="data_li" @click="li_show_param_obj">Param</li>
                        <li class="data_li" @click="li_show_headers_obj">Headers</li>
                        <li class="data_li" @click="li_show_body_obj">Body</li>
                        <li class="data_li" @click="li_show_tests_obj">Tests</li>
                    </ul>
                    <!-- 模块下划线 -->
                    <hr class="li_param" v-show="li_show_param">
                    <hr class="li_headers" v-show="li_show_headers">
                    <hr class="li_body" v-show="li_show_body">
                    <hr class="li_tests" v-show="li_show_tests">
                    <!-- params模块 -->
                    <div class="data_div" v-show="params_show">
                        <div class="title_th_div">
                            <ul>
                                <li class="li_title">KEY</li>
                                <li class="li_title">VALUE</li>
                            </ul>
                        </div>
                        <div class="data_td_div">
                            <table class="data_table" @change="params_key_change">
                                <tr v-for="(item,index) in params_list" :key="index">
                                    <td><input type="text" class="data_input" v-model="input_params_key[index]" ></td>
                                    <td><input type="text" class="data_input" v-model="input_params_value[index]"></td>
                                </tr>
                            </table>
                        </div>
                        <!-- 增加一行 按钮 -->
                        <button class="add_li" @click="add_params_li">+</button>
                    </div>
                    <!-- headers模块 -->
                    <div class="data_div" v-show="headers_show">
                        <div class="title_th_div">
                            <ul>
                                <li class="li_title">KEY</li>
                                <li class="li_title">VALUE</li>
                            </ul>
                        </div>
                        <div class="data_td_div">
                            <table class="data_table" @change="headers_key_change">
                                <tr v-for="(item,index) in headers_list" :key="index">
                                    <td><input type="text" class="data_input" v-model="input_headers_key[index]" ></td>
                                    <td><input type="text" class="data_input" v-model="input_headers_value[index]"></td>
                                </tr>
                            </table>
                        </div>
                        <!-- 增加一行 按钮 -->
                        <button class="add_li" @click="add_headers_li">+</button>
                    </div>
                    <!-- body模块 -->
                    <div class="data_div" v-show="body_show">
                        <div class="title_th_div">
                            <ul>
                                <li class="li_title">KEY</li>
                                <li class="li_title">VALUE</li>
                            </ul>
                        </div>
                        <div class="data_td_div">
                            <table class="data_table" @change="body_key_change">
                                <tr v-for="(item,index) in body_list" :key="index">
                                    <td><input type="text" class="data_input" v-model="input_body_key[index]" ></td>
                                    <td><input type="text" class="data_input" v-model="input_body_value[index]"></td>
                                </tr>
                            </table>
                        </div>
                        <!-- 增加一行 按钮 -->
                        <button class="add_li" @click="add_body_li">+</button>
                    </div>
                    <!-- tests模块 -->
                    <div class="data_div" v-show="tests_show">
                        <!-- 文本输入框 -->
                        <textarea name="" id="tests_text" cols="30" rows="10" v-model="input_tests"></textarea>
                        <!-- <button class="btn_go" @click="go_click">>></button> -->
                    </div>
                </div>
                <!-- 响应值区域 -->
                <div class="resp_div">
                    <span class="resp_word">Response</span>
                    <hr class="part">
                    <div class="resp_data">
                        {{resp_body}}
                    </div>
                </div>
            </div>

<!-- 设置左侧的二级菜单  这个为左侧的最外部的盒子 -->
            <div class="show_page">
                <div v-for="(project,index) in pList" :key="index"    @mouseover="getId(index)">
                    <div class="show_project_div" >
                        <div id="list_one" @click="toggle(project)">
                            
                            {{project.title}}

                        </div>
                        <!-- 一级标题 -->
                        <div class='menu'>
                            <ul>
                                <!-- 重命名函数 -->
                                <li @click="rename_project">Rename</li>
                                <!-- 新建接口测试平台函数 -->
                                <li @click="create_interface_test"> Add request</li>
                                <li @click="del_project(index)">Delete</li>
                            </ul>
                        </div>
                     </div>
                    <div v-if="project.show"   v-show="content_li">
                        
                        <div v-for="(obj,i) in project.content" :key="i" class="content_li" @click="getObj(i)" >
                            <ul >
                                <li class="one" @click="addTab">
                                    <a class="content_li_a" href="" @click.prevent >{{obj.name}}</a> 

                                   <!-- 二级标题的悬 浮菜单盒子 -->
                                    <div class='case_menu'>
                                        <ul>
                                            <!-- case重命名函数 -->
                                            <li @click="rename_case">Rename</li>
                                            <!-- case删除函数 -->
                                            <li @click="del_case(i)">Delete</li>
                                        </ul>
                                    </div>
                                </li>
                            </ul>
                        </div>
                       
                    </div>
               
                </div>
               
            </div>

            

            <!-- 菜单中的新建项目的div -->
            <div class="creat_project_page" v-show="creat_project_present">
                <div class="creat_project_page_title_div">
                    <span id="creat_project_page_title">New Collection</span>
                </div>
                <div class="project_name_div">
                    <span  class="project_name">Name:</span><br>
                    <input id='project_name_input' type="text" v-model="project_name">
                </div>
                <div class='creat_project_page_btn'>
                    <button id='creat_project_page_create' @click="create_success"> Create </button>
                    <button id='creat_project_page_cancle' @click="create_cancle"> Cancle </button>
                </div>
            </div>
            
            <!-- 菜单中重命名的盒子 -->
            <div class="creat_project_page" v-show="rename_project_present">
                <div class="creat_project_page_title_div">
                    <span id="creat_project_page_title">RENAME</span>
                </div>
                <div class="project_name_div">
                    <span  class="project_name">New Name</span><br>
                    <input id='project_name_input' type="text" v-model="project_rename">
                </div>
               
                <div class='creat_project_page_btn'>
                    <button id='creat_project_page_create' @click="rename_success"> OK </button>
                    <button id='creat_project_page_cancle' @click="rename_cancle"> Cancle </button>
                </div>
            </div>

            <!-- 菜单中创建测试接口的盒子 -->
            <div class="creat_project_page" v-show="create_interface_present">
                <div class="creat_project_page_title_div">
                    <span id="creat_project_page_title">Add requset</span>
                </div>
                <div class="project_name_div">
                    <span  class="project_name"> name</span><br>
                    <input id='project_name_input' type="text" v-model="interface_name">
                </div>
              
                <div class='creat_project_page_btn'>
                    <button id='creat_project_page_create' @click="create_interface_success"> Create </button>
                    <button id='creat_project_page_cancle' @click="create_interface_cancle"> Cancle </button>
                </div>
            </div>
            
            <!-- 子菜单中重命名的盒子 -->
            <div class="creat_project_page" v-show="rename_cases_present">
                <div class="creat_project_page_title_div">
                    <span id="creat_project_page_title">RENAME </span>
                </div>
                <div class="project_name_div">
                    <span  class="project_name">New name</span><br>
                    <input id='project_name_input' type="text" v-model="case_rename">
                </div>
                
                <div class='creat_project_page_btn'>
                    <button id='creat_project_page_create' @click="rename_case_success"> OK </button>
                    <button id='creat_project_page_cancle' @click="rename_case_cancle"> Cancle </button>
                </div>
            </div>

            

        </div>

    </div>
</body>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script>
    Vue.config.productionTip=false //阻止 vue 在启动时生成生产提示

    new Vue({
        el:'#bg1',
        data:{

            creat_project_present:false,
            rename_project_present:false,
            rename_cases_present:false,
            create_interface_present:false,
            content_li:false,
            case_tite:false,

            arr:[{}],
            idNUm:0,
            listNum:0,
            pList:[{}],
            project_name:'',
            tab_title:'',
            project_rename:'',
            case_rename:'',
            interface_name:'',
            project_description:'',
            rename_project_description:'',
            rename_case_description:'',
            interface_testing_description:'',

            // url方法
            apimethods:'get',

            // 4个点击下划线
            li_show_param:true,
            li_show_headers:false,
            li_show_body:false,
            li_show_tests:false,

            // 4个显示框
            params_show:true,
            headers_show:false,
            body_show:false,
            tests_show:false,

            // 增加的表格数组
            params_list:[],
            headers_list:[],
            body_list:[],
            // url
            get_url:'',

            // 输入框的值
            input_params_key:[],
            input_params_value:[],
            input_headers_key:[],
            input_headers_value:[],
            input_body_key:[],
            input_body_value:[],
            input_tests:'',

            // 表格对象
            obj_params:{},
            obj_body:{},
            obj_headers:{},
            trans_body:{},

            // 响应体
            resp_body:''
        },
        methods: {
            // 4个页面点击显示
            li_show_param_obj(){
                this.li_show_param=true
                this.li_show_headers=false
                this.li_show_body=false
                this.li_show_tests=false

                this.params_show=true
                this.headers_show=false
                this.body_show=false
                this.tests_show=false
            },
            li_show_headers_obj(){
                this.li_show_headers=true
                this.li_show_param=false
                this.li_show_body=false
                this.li_show_tests=false

                this.params_show=false
                this.headers_show=true
                this.body_show=false
                this.tests_show=false
            },
            li_show_body_obj(){
                this.li_show_body=true
                this.li_show_headers=false
                this.li_show_param=false
                this.li_show_tests=false

                this.params_show=false
                this.headers_show=false
                this.body_show=true
                this.tests_show=false
            },
            li_show_tests_obj(){
                this.li_show_tests=true
                this.li_show_param=false
                this.li_show_headers=false
                this.li_show_body=false

                this.params_show=false
                this.headers_show=false
                this.body_show=false
                this.tests_show=true
            },
            // 增加一行表格
            add_params_li(){
                this.params_list.push({
                    key:'',
                    value:''
                })
            },
            add_headers_li(){
                this.headers_list.push({
                    key:'',
                    value:''
                })
            },
            add_body_li(){
                this.body_list.push({
                    key:'',
                    value:''
                })
            },
            // 当url改变，实现url拆分并填入params表格
            url_change(){
                this.params_list=[]
                if(this.get_url.includes('?')){
                    let urlarg=this.get_url.slice(this.get_url.indexOf('?')+1)
                    let arr = urlarg.split('&').map(function (item, index, arr) {
                        return item.split('=')
                    })
                    for(var i=0;i<arr.length;i++){
                        this.add_params_li()
                        this.input_params_key[i]=arr[i][0]
                        this.input_params_value[i]=arr[i][1]
                        
                    }
                }
            },
            // 当params数据改变，实现url拼接
            params_key_change(){
                this.obj_params={}
                for(var n=0;n<this.input_params_key.length;n++){
                        if(this.input_params_key[n]){
                            const key=this.input_params_key[n]
                            if(!this.input_params_value[n]){
                                this.input_params_value[n]=''
                            }
                            const value=this.input_params_value[n]
                            this.$set(this.obj_params,key,value)
                        }else{
                            this.params_list.splice(n,1)
                            this.input_params_key.splice(n,1)
                            this.input_params_value.splice(n,1)
                            this.params_key_change()
                        }
                }
                let new_url=this.get_url
                if(this.get_url.includes('?')){
                    new_url=this.get_url.substring(0,this.get_url.lastIndexOf("?"))
                }
                this.get_url=new_url+'?'
                for(let item in this.obj_params){
                    if(item){
                        this.get_url=this.get_url+'&'+item+'='+this.obj_params[item]
                    }
                }
            },
            // 当headers里的数据改变，更新请求头对象
            headers_key_change(){
                this.obj_headers={}
                let req_headers='{'
                for(var n=0;n<this.input_headers_key.length;n++){
                    if(this.input_headers_key[n]){
                        const key=this.input_headers_key[n]
                        if(!this.input_headers_value[n]){
                            this.input_headers_value[n]=''
                        }
                        const value=this.input_headers_value[n]
                        this.$set(this.obj_headers,key,value)
                    }else{
                            this.headers_list.splice(n,1)
                            this.input_headers_key.splice(n,1)
                            this.input_headers_value.splice(n,1)
                            this.headers_key_change()
                        }
                }
                for(let item in this.obj_body){
                    req_headers=req_headers+item+':'+this.obj_headers[item]+'; '
                }
                req_headers=req_headers+'}'
                console.log(req_headers)
            },
            // 当body里的值改变，更新请求体对象
            body_key_change(){
                this.obj_body={}
                let req_body='{'
                for(var n=0;n<this.input_body_key.length;n++){
                    if(this.input_body_key[n]){
                        const key=this.input_body_key[n]
                        if(!this.input_body_value[n]){
                            this.input_body_value[n]=''
                        }
                        const value=this.input_body_value[n]
                        this.$set(this.obj_body,key,value)
                    }else{
                            this.body_list.splice(n,1)
                            this.input_body_key.splice(n,1)
                            this.input_body_value.splice(n,1)
                            this.body_key_change()
                        }
                }
                for(let item in this.obj_body){
                    req_body=req_body+item+':'+this.obj_body[item]+'; '
                }
                req_body=req_body+'}'
                console.log(req_body)
            },
            // send函数
            send_click(){
                if(this.apimethods=='get'){
                    this.getSendInfo()
                }else{
                    this.postSendInfo()
                }
            },
            // go函数
            go_click(){
                console.log(this.input_tests)
                this.postTestInfo()
            },

            // 点击加号的位置创建项目函数
            creat_project_page_show(){
                this.creat_project_present=true
            },
            // 项目创建成功
            create_success(){
                this.pList.push({title:this.project_name,content:[{}],show:true})
                this.creat_project_present=false
                this.project_name=''
                this.project_description=''
            },
            // 项目创建失败
            create_cancle(){
                this.creat_project_present=false
                this.project_name=''
                this.project_description=''
            },
            // 重命名项目的函数
            rename_project(){
                this.rename_project_present=true
            },
            // 项目重命名成功
            rename_success(){
                this.pList[this.idNUm].title=this.project_rename
                this.project_rename=''
                this.rename_project_description=''
                this.rename_project_present=false
            },
            // 项目重命名失败
            rename_cancle(){
                this.rename_project_present=false
                this.project_rename=''
                this.rename_project_description=''
            },
            // 在项目的悬浮菜单创建子菜单（接口测试）的函数
            create_interface_test(){
                this.create_interface_present=true
            },
            // 创建接口测试成功函数
            create_interface_success(){
                this.pList[this.idNUm].content.push({name:this.interface_name})
                // this.obj.push({name:this.interface_name})
                // this.pList.content.push(obj)
                this.content_li=true
                this.create_interface_present=false
                this.interface_name=''
                this.interface_testing_description=''
            },
            // 创建接口失败函数
            create_interface_cancle(){
                this.create_interface_present=false
                this.interface_name=''
                this.interface_testing_description=''
            },
            // 点击子菜单在页面中显示
            addTab(){
                this.tab_title=this.pList[this.idNUm].content[this.listNum].name
                this.case_tite=true
            },


            // 这个函数的位置是不是应该将数据的内容清空，显示一个默认的数据
            del_tab(){
                this.case_tite=false
                this.tab_title=''
            },
            // 获取项目下标函数
            getId(index){
                this.idNUm=index;
                console.log(this.idNUm)
            },
            // 获得子菜单下标函数
            getObj(i){
                this.listNum=i;
                console.log(this.listNum)
            },
            // 下拉菜单隐藏显示函数
            toggle(project){
                project.show = !project.show
            },
            // 删除项目的函数
            del_project(index) {
                this.pList.splice(index, 1) 
                
            },
            // 子项目重命名函数
            rename_case(){
                this.rename_cases_present=true
            },
            
            // 子菜单重命名成功
            rename_case_success(){
                console.log(this.pList[this.idNUm].content)
                this.pList[this.idNUm].content[this.listNum].name=this.case_rename
                this.tab_title=this.case_rename
                this.rename_cases_present=false
                this.case_rename=''
                this.rename_case_description=''
            },
            // 删除子项目的函数
            del_case(i){
                console.log(this.pList[this.idNUm].content)
                this.arr=this.pList[this.idNUm].content
                this.arr.splice(i,1)
                
            },
            // 在菜单重命名取消
            rename_case_cancle(){
                this.rename_cases_present=false
                this.case_rename=''
                this.rename_case_description=''
            },

            // axios函数
            // 发送请求
            postSendInfo(){
                let url="http://192.168.2.11:9091/doService/postService.do"
                let headers_str=JSON.stringify(this.obj_headers)
                let body_str=JSON.stringify(this.obj_body)
                console.log(headers_str+"______"+body_str)
                axios.post(url,{
                    "apiMethods":this.apimethods,
                    "url":this.get_url,
                    "headers":headers_str,
                    "body":body_str
                }).then((info)=>{
                    console.log(info)
                    if(info.data.code==0){
                        this.resp_body=info.data.data
                    }else{
                        this.resp_body=info.data.msg
                    }
                })
            },
            getSendInfo(){
                let url="http://192.168.2.11:9091/doService/getServe.do"
                axios.post(url,{
                    "apiMethods":this.apimethods,
                    "url":this.get_url
                }).then((info)=>{
                    console.log(info.data)
                    if(info.data.code==0){
                        this.resp_body=info.data.data
                    }else{
                        this.resp_body=info.data.msg
                    }
                })
            },
            postTestInfo(){
                let url="http://192.168.2.11:9091/test/getToken"
        
                axios.post(url,{"tests":this.input_tests,"url":this.get_url}).then((info)=>{
                    this.input_tests=this.input_tests + "\n\n返回的内容：" + info.data.data
                })
                
            }

        }
    })
</script>
</html>